#include"vector2.h"
#include <math.h>
#include <stdio.h> 
struct Vector2 _vector2;
struct V2s _addf(struct V2s v2s1, struct V2s v2s2) {
	struct V2s v2sRet= {
		.x = v2s1.x + v2s2.x,
		.y=v2s1.y+v2s2.y
	};
	return v2sRet;
}
double _getDisf(struct V2s v2s1,struct V2s v2s2) {
	double dis = 0;
	int dx =fabs(v2s1.x - v2s2.x);
	int dy =fabs(v2s1.y - v2s2.y);
	dis = pow(dx*dx+dy*dy,0.5);
	return dis;
}

void test_vector2() {
	struct V2s Vect2[2] = {
		{
			.x=1,.y=1
		},{
			.x=2,.y=2
		}
	};
	struct V2s v = _vector2._add(Vect2[0],Vect2[1]);
	printf("v.x=%d\nv.y=%d\n",v.x,v.y);
}
void test_v2sDis() {
	struct V2s Vect2[2] = {
		{
			.x=1,.y=1
		},{
			.x=2,.y=2
		}
	};
	double dis = _vector2._getDis(Vect2[0],Vect2[1]);
	int cv = (int)dis;
	printf("dis=%d\n",cv);
}
